package com.sgcc.system.api.factory;

import java.util.ArrayList;
import java.util.List;

import com.sgcc.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.sgcc.common.core.web.domain.AjaxResult;
import com.sgcc.common.core.web.page.TableDataInfo;
import com.sgcc.system.api.RemoteRoleService;
import com.sgcc.system.api.domain.SysRole;

import feign.hystrix.FallbackFactory;

/**
 * 用户服务降级处理
 * 
 * @author sgcc
 */
@Component
public class RemoteRoleFallbackFactory implements FallbackFactory<RemoteRoleService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteRoleFallbackFactory.class);

    @Override
    public RemoteRoleService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteRoleService()
        {



			@Override
			public TableDataInfo selectRoleList(SysRole role) {
				// TODO Auto-generated method stub
				TableDataInfo r=new TableDataInfo();
				r.setCode(500);
				r.setMsg("获取角色列表失败，请重启服务~");
				return r;
			}

			@Override
			public R<SysRole> getInfoISC(String roleId) {
				// TODO Auto-generated method stub
				return R.fail("获取角色信息失败，请稍后在试~");
			}

			@Override
			public R<Integer> addISC(SysRole role) {
				// TODO Auto-generated method stub
				return R.fail("添加角色失败，请稍后在试~");
			}

			@Override
			public R<Integer> editISC(SysRole role) {
				// TODO Auto-generated method stub
				return R.fail("更新角色信息失败，请稍后在试~");
			}


        };
    }
}
